package com.wyw.learning.thread.threadlocal;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 两个线程打印日期
 *
 * @author Mr Wu    yewen.wu.china@gmail.com
 * @date 2021/7/6   9:20 下午
 * <p>
 * Update History:
 * Author        Time            Content
 */
public class ThreadLocalNormalUsage00 {

    public static void main(String[] args) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(new ThreadLocalNormalUsage00().date(10));
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(new ThreadLocalNormalUsage00().date(1000));
            }
        }).start();
    }

    public String date(int seconds){
        Date date = new Date(1000 * seconds);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(date);
    }
}
